home *** CD-ROM | disk | FTP | other *** search
/ C/C++ Users Group Library 1996 July / C-C++ Users Group Library July 1996.iso / vol_200 / 265_01 / rdsct.asm < prev    next >
Assembly Source File  |  1990-02-13  |  1KB  |  47 lines

  1. ;
  2. ;    absolute sector read routine
  3. ;    ----------------------------
  4. ;    written by    Rainer Gerhards
  5. ;            Petronellastr. 6
  6. ;            D-5112 Baesweiler
  7. ;            West Germany
  8. ;
  9. ;    This Module supports only the small memory model of any compiler!
  10. ;
  11. X    equ    4
  12. _TEXT    segment    byte public 'CODE'    ; Turbo C (and MSC?)
  13. ;PROG    segment    byte public 'PROG'    ; Lattice and Dataligth C
  14.     assume    cs:_TEXT
  15.     public    _rdsct
  16. _rdsct    proc    near            ; use _rdsct for Turbo and MS C
  17.     push    bp
  18.     mov    bp, sp
  19.     push    bx
  20.     push    cx
  21.     push    dx
  22.     push    si
  23.     push    di
  24.  
  25.     mov    dx, [bp]+X        ; sector number
  26.     mov    bx, [bp]+X+2        ; buffer address (must be in DS:)
  27.     mov    cx, 1            ; always one sector
  28.     mov    al, 0            ; from drive A:
  29.     int    25h            ; read sector
  30.     jc    err            ; error?
  31.     xor    ax, ax            ; no, clear ruturn value
  32.     jmp    short return        ; and exit
  33. err:    mov    ax, 1            ; indicate error
  34.  
  35. return:    popf                ; leaved on stack (damned!)
  36.     pop    di
  37.     pop    si
  38.     pop    dx
  39.     pop    cx
  40.     pop    bx
  41.     pop    bp
  42.     ret
  43. _rdsct    endp                ; _rdsct for Turbo and MS C
  44. _TEXT    ends                ; _TEXT for Turbo and MS C
  45. ;PROG    ends
  46.     end
  47.